package com.fsnbigdata.domain;
import org.springframework.roo.addon.javabean.annotations.RooEquals;
import org.springframework.roo.addon.javabean.annotations.RooJavaBean;
import org.springframework.roo.addon.javabean.annotations.RooToString;
import org.springframework.roo.addon.jpa.annotations.entity.RooJpaEntity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Version;
import io.springlets.format.EntityFormat;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import java.util.Objects;
import javax.persistence.Entity;

/**
 * = PhenologyRecord
 *
 * TODO Auto-generated class documentation
 *
 */
@RooJavaBean
@RooToString
@RooJpaEntity(entityFormatExpression = "#{introNo}")
@RooEquals(isJpaEntity = true)
@Entity
@EntityFormat("#{introNo}")
public class PhenologyRecord {

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @Version
    private Integer version;

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @EntityFormat
    private PlantConservation plantConservation;

    /**
     * 引种号
     */
    private String introNo;

    /**
     * 观测地
     */
    private String location;

    /**
     * 观测年份
     */
    private String observeYear;

    /**
     * 观测人
     */
    private String observer;

    /**
     * 萌动期
     */
    private String phaseOne;

    /**
     * 展叶期
     */
    private String phaseTwo;

    /**
     * 开花期
     */
    private String phaseThree;

    /**
     * 果熟期
     */
    private String phaseFour;

    /**
     * 叶变色期
     */
    private String phaseFive;

    /**
     * 落叶期
     */
    private String phaseSix;

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    public static final String ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE = "The given Iterable of items to add can't be null!";

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    public static final String ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE = "The given Iterable of items to add can't be null!";

    /**
     * This `equals` implementation is specific for JPA entities and uses
     * the entity identifier for it, following the article in
     * https://vladmihalcea.com/2016/06/06/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
     *
     * @param obj
     * @return Boolean
     */
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        // instanceof is false if the instance is null
        if (!(obj instanceof PhenologyRecord)) {
            return false;
        }
        return getId() != null && Objects.equals(getId(), ((PhenologyRecord) obj).getId());
    }

    /**
     * This `hashCode` implementation is specific for JPA entities and uses a fixed `int` value to be able
     * to identify the entity in collections after a new id is assigned to the entity, following the article in
     * https://vladmihalcea.com/2016/06/06/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
     *
     * @return Integer
     */
    public int hashCode() {
        return 31;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Long
     */
    public Long getId() {
        return this.id;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Integer
     */
    public Integer getVersion() {
        return this.version;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param version
     */
    public void setVersion(Integer version) {
        this.version = version;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return PlantConservation
     */
    public PlantConservation getPlantConservation() {
        return this.plantConservation;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param plantConservation
     */
    public void setPlantConservation(PlantConservation plantConservation) {
        this.plantConservation = plantConservation;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getIntroNo() {
        return this.introNo;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param introNo
     */
    public void setIntroNo(String introNo) {
        this.introNo = introNo;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getLocation() {
        return this.location;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param location
     */
    public void setLocation(String location) {
        this.location = location;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getObserveYear() {
        return this.observeYear;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param observeYear
     */
    public void setObserveYear(String observeYear) {
        this.observeYear = observeYear;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getObserver() {
        return this.observer;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param observer
     */
    public void setObserver(String observer) {
        this.observer = observer;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getPhaseOne() {
        return this.phaseOne;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param phaseOne
     */
    public void setPhaseOne(String phaseOne) {
        this.phaseOne = phaseOne;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getPhaseTwo() {
        return this.phaseTwo;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param phaseTwo
     */
    public void setPhaseTwo(String phaseTwo) {
        this.phaseTwo = phaseTwo;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getPhaseThree() {
        return this.phaseThree;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param phaseThree
     */
    public void setPhaseThree(String phaseThree) {
        this.phaseThree = phaseThree;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getPhaseFour() {
        return this.phaseFour;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param phaseFour
     */
    public void setPhaseFour(String phaseFour) {
        this.phaseFour = phaseFour;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getPhaseFive() {
        return this.phaseFive;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param phaseFive
     */
    public void setPhaseFive(String phaseFive) {
        this.phaseFive = phaseFive;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String getPhaseSix() {
        return this.phaseSix;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param phaseSix
     */
    public void setPhaseSix(String phaseSix) {
        this.phaseSix = phaseSix;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return String
     */
    public String toString() {
        return "PhenologyRecord {" + "id='" + id + '\'' + ", version='" + version + '\'' + ", introNo='" + introNo + '\'' + ", location='" + location + '\'' + ", observeYear='" + observeYear + '\'' + ", observer='" + observer + '\'' + ", phaseOne='" + phaseOne + '\'' + ", phaseTwo='" + phaseTwo + '\'' + ", phaseThree='" + phaseThree + '\'' + ", phaseFour='" + phaseFour + '\'' + ", phaseFive='" + phaseFive + '\'' + ", phaseSix='" + phaseSix + '\'' + ", ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE='" + ITERABLE_TO_ADD_CANT_BE_NULL_MESSAGE + '\'' + ", ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE='" + ITERABLE_TO_REMOVE_CANT_BE_NULL_MESSAGE + '\'' + "}" + super.toString();
    }
}
